package Exeption;

import java.util.Scanner;

public class Test3 {

    public static int func3(int num) throws RuntimeException, ArithmeticException{
        if (num < 0) {
            throw new RuntimeException();
        } else if (num == 0) {
            throw new ArithmeticException();
        }

        return num;
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = 0;

        try {
            a = func3(sc.nextInt());
        } catch (ArithmeticException e) {
            e.printStackTrace();
        } catch (RuntimeException e) {
            e.printStackTrace();
        }

        System.out.println(a);
    }
}
